home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-2.iso / extra_2 / nadir11.zip / DEMO.N < prev    next >
Text File  |  1995-11-08  |  4KB  |  99 lines

  1. Eval {
  2.     pre = "mdat^menu^demo";
  3.     [pre]^[100] = "InvMenu";
  4.     [pre]^[101] = "PhoneList";
  5.     [pre]^[102] = "DemoTest";
  6.     [pre]^[103] = "SysUtils";
  7. }
  8. Define Demo() {
  9.     /* 
  10.         note, parm^demo^func will be set at this point if this prog was
  11.         not exited correctly, or, we are cycling on a signal, in which 
  12.         case parm^demo^func will hold the current function we are performing.
  13.         A way to initialize parm^demo^func is to use the before macro 
  14.         command line switch to run a macro to clear it first time through.
  15.     */
  16.     isDos = SysType() == "DOS";
  17.     while (1) {
  18.         if (!parm^demo^func^[TaskNum()]) {
  19.             scr = SdCreate("Demo", -2, -2, isDos ? 14 : 10, 40, 
  20.                            "Nadir Demonstration");
  21.             SdPrompt(scr, 1, 2, "Please select an application");
  22.             SdButton(scr,,1, 3, 7, 26, "Invoicing Program", "i", 100);
  23.             SdButton(scr,,1, isDos ? 5 : 4, 7, 26,"Phone List", "p", 101);
  24.             SdButton(scr,,1, isDos ? 7 : 5, 7, 26,"Demos and Tests","t", 102);
  25.             SdButton(scr,,1, isDos ? 9 : 6, 7, 26,"System Utilities","s", 103);
  26.             SdButton(scr, "can",  1, isDos ? 12 : 8, 15, 10, "Close", "c", 3);
  27.  
  28.             cmd = SdEdit(scr);
  29.             SdDestroy(scr);
  30.  
  31.             switch (cmd) {
  32.             case 2:             // cancel
  33.             case 3:             // close
  34.                 parm^demo^func^[TaskNum()] = "";
  35.                 return;
  36.             default:
  37.                 parm^demo^func^[TaskNum()] = mdat^menu^demo^[cmd];
  38.             }
  39.         }
  40.         [parm^demo^func^[TaskNum()]](); // perform the selected (or current) function
  41.         parm^demo^func^[TaskNum()] = "";
  42.     }
  43. }
  44. Define MenuSel(title, prompt, pre) {
  45. /*
  46.     implements a menu of choices using a select box
  47.     title is title of screen
  48.     prompt is a prompt written on row 1
  49.     pre - prefix of menu items
  50.     menu items are of the form
  51.     [pre][funcDes]    = func
  52.     eg mdat^menu^dtst^["Run Xtree"]   = "RunXtree";
  53. */
  54.     while (1) {
  55.         scr = SdCreate(, -2, -2, 13, 40, title);
  56.         SdPrompt(scr, 1, 2, prompt);
  57.         SdSelect(scr, "sel",  1, 3, 5, 30, 7, &funcDes, pre, 100);
  58.         SdButton(scr, "can",  1, 11, 15, 10, "Cancel", "", 2);
  59.         cmd = SdEdit(scr);
  60.         SdUpdate(scr);
  61.         SdDestroy(scr);
  62.         switch (cmd) {
  63.         case 2:             // cancel
  64.         case 3:             // close
  65.             return cmd;
  66.         }
  67.         [[pre][funcDes]]();
  68.     }
  69. }
  70. Eval {
  71.     pre = "mdat^menu^dtst";
  72.     [pre]^["Multi Line Edits"]  = "TestMultiEd";
  73.     [pre]^["Process Intrinsic"] = "TestProcess";
  74.     [pre]^["Run Xtree"]         = "RunXtree";
  75.     [pre]^["Screen Dialogues"]  = "TestWinput";
  76. }
  77. Define DemoTest() {
  78.     MenuSel("Demo and Tests",
  79.             "Please select a program",
  80.             "mdat^menu^dtst^");
  81. }
  82. Eval {
  83.     pre = "mdat^menu^sute";
  84.     [pre]^["Load Symbol Data"]              = "LoadSymbols";
  85.     [pre]^["Unload Symbol Data"]            = "UnloadSymbols";
  86.     [pre]^["System Parameters"]             = "SysParm";
  87.     [pre]^["Windows Dialogue Parameters"]   = "SysSdParm";
  88.     [pre]^["DOS Screen Attributes"]         = "DosScreenAttr";
  89.     [pre]^["Printer Parameters"]            = "PrinterSetup";
  90.     [pre]^["Table Maintenance"]             = "MtceSelect";
  91.     [pre]^["DOS Shell"]     = "System";  // note, can be an Intrinsic Func
  92. }
  93. Define SysUtils() {
  94.     MenuSel("System Utilities",
  95.             "Please select a utility",
  96.             "mdat^menu^sute^");
  97. }
  98.  
  99.